﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaiser.Repositories;

namespace Kaiser.Services.Impl
{
    public class RoleService : IRoleService
    {
        private readonly IRepository _repository;

        public RoleService(IRepository repository)
        {
            _repository = repository;//
        }

        public Models.Role GetItem(Guid roleId)
        {
            try
            {
                return _repository.GetRoleItem(roleId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Models.Role GetItem(string roleName)
        {
            try
            {
                return _repository.GetRoleItem(roleName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public List<Models.RoleBasic> GetList()
        {
            try
            {
                return _repository.GetRoleList();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void Save(Models.InputModels.RoleInput roleInput)
        {
            try
            {
                  _repository.Save(roleInput);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool Remove(Guid roleId)
        {
            try
            {
                return _repository.Remove(roleId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
